/**
 * 
 */
package com.goldsign.pay.common.core.entity;

import java.util.Calendar;
import java.util.Date;


import com.goldsign.pay.common.core.entity.base.BaseEntity;
import com.goldsign.pay.common.core.persistence.enums.GenReasonEnum;
import com.goldsign.pay.common.core.util.IdGenerate;

/**
 * @author johnny
 *
 */
public   class DataEntity<T> extends BaseEntity {
	private static final long serialVersionUID = 1L;
	public int createby ;// '创建人'
	public Date createtime  ;// '创建时间'
	public int  updateby ;// '更新时间'
	public Date updatetime  ;// '更新人'
	public int delflag  ;//'删除标记:0有效1已删除'
	public String vs  ;// '记录版本号'

	protected DataEntity() {
		super();
		this.delflag = 0 ; 
	}

	protected DataEntity(String id) {
		super(id);
		this.delflag = 0 ; 
	}
	
//	public String getDbName(){
////		return Global.getConfig("jdbc.type");
//		return "mysql";
//	}
	
	@Override
	public void preInsert() {
		this.id = IdGenerate.nextId();
		this.createtime = Calendar.getInstance().getTime();
	}

	@Override
	public void preUpdate() {
		this.updatetime = Calendar.getInstance().getTime();
	}

	@Override
	public void preUpdateWithBackup(GenReasonEnum reson) {
		// TODO Auto-generated method stub
		
	}

	public int getCreateby() {
		return createby;
	}

	public void setCreateby(int createby) {
		this.createby = createby;
	}

	public Date getCreatetime() {
		return createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}

	public int getUpdateby() {
		return updateby;
	}

	public void setUpdateby(int updateby) {
		this.updateby = updateby;
	}

	public Date getUpdatetime() {
		return updatetime;
	}

	public void setUpdatetime(Date updatetime) {
		this.updatetime = updatetime;
	}

	public int getDelflag() {
		return delflag;
	}

	public void setDelflag(int delflag) {
		this.delflag = delflag;
	}

	public String getVs() {
		return vs;
	}

	public void setVs(String vs) {
		this.vs = vs;
	}

	@Override
	public String toString() {
		return "DataEntity [id = "+ id + ",vs=" + vs + "]";
	}
	
}
